package com.example.day5;

import java.lang.reflect.Method;
import java.util.function.BinaryOperator;

/**
 * 闭包
 */
public class C04Closure {

    static int c = 10;

    // -Djdk.invoke.LambdaMetafactory.dumpProxyClassFiles
    public static void main(String[] args) {
        BinaryOperator<Integer> lambda = (a, b) -> a + b + c;
        test(lambda);
        /*System.out.println(lambda.apply(1, 2));
        c = 20;
        System.out.println(lambda.apply(1, 2));*/
        for (Method method : C04Closure.class.getDeclaredMethods()) {
            System.out.println(method);
        }
    }

    static void test(BinaryOperator<Integer> lambda) {

    }

    private static Integer lambda$main$1(Integer a, Integer b) {
        return a + b + C04Closure.c;
    }

}
